<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>编辑用户</title>
  </head>
  
    <script type="text/javascript">
   (function($){  
     $.imap = function(){  
          var imap = this.map = {};  
          this.get = function(key){  
              var val = eval("imap."+key);  
              return  (typeof val === undefined) ? null : val;  
          };  
          this.set = function(key,value){  
              eval("imap."+key+"=value");  
          };  
     };  
  })(jQuery); 
  	var map = new jQuery.imap();
  </script>
  <body>
	<div class="pageContent">
		<form method="post" action="<%=path %>/sendMsg/saveSendMsg.action" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
			<div class="pageFormContent" layoutH="56">
				<input name="sendMsgVO.id" type="hidden" value="<s:property value="sendMsgVO.id" />" />

				<p>
					<label>标题：</label>
					<input name="sendMsgVO.title" value="<s:property value="sendMsgVO.title" />"  type="text" size="30" alt="请输入标题"/>
				</p>
				<p>
					<label>类型：</label>
					<input name="sendMsgVO.msgType" value="<s:property value="sendMsgVO.msgType" />"  type="text" size="30" alt="请输入类型"/>
				</p>
				<p>
					<label>发送时间：</label>
					<input name="sendMsgVO.sendTime" value="<s:property value="sendMsgVO.sendTime" />" class="required" type="text" size="30" alt="请输入发送时间"/>
				</p>
				<!-- 
				<p>
					<label>周期：</label>
					<input name="sendMsgVO.scheduleType" value="<s:property value="sendMsgVO.scheduleType" />" class="required" type="text" size="30" alt="请输入周期"/>
				</p>
				 -->
				<p>
					<label>状态：</label>
					<select name="sendMsgVO.status" >
                        <option value="">选择状态</option>
                        <c:forEach var="item" items="${statuses}">
                        	<option value="${item.name}" ${sendMsgVO.status eq item.name ? "selected" : "" }>${item.title}</option>
                        </c:forEach>
                   </select>
				</p>
				
				<p>
					<label>模板：</label>
					<select name="sendMsgVO.template.id" onChange="$('#content').val(map.get('I'+this.value));">
                        <option value="">选择模板</option>
                        <c:forEach var="item" items="${templates}">
                        	<option value="${item.id}" ${sendMsgVO.template.id eq item.id ? "selected" : "" }>${item.name}</option>
                        	<script>map.set('I${item.id}','${item.content}');</script>
                        </c:forEach>
                   </select>
				</p>
				<p>
					<label>内容：</label>
					<input name="sendMsgVO.content" value="<s:property value="sendMsgVO.content" />" class="required" type="text" size="30" alt="请输入内容"/>
				</p>
				<p>
					<label>目标用户：</label>
					<input name="sendMsgVO.users" value="<s:property value="sendMsgVO.users" />" class="required" type="text" size="30" alt="请输入目标用户"/>
				</p>
			</div>
			<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>
		</form>
	</div>
  </body>
</html>